The objective of this option is to extract all the character
strings from a source file, and put them in a table, that can be translated
into several languages.
Basically, Wedit will search for all sequence of character
enclosed in double quotes, excluding commentaries. Preprocessor directives are
not understood. All the character strings will be shown in a dialog box,
allowing you to exclude certain strings you do not want to have in the table,
or to change the number you want to assign them, in the case that you are
generating a .rc file.
The output of this operation is:
1) A file will be generated containing a table of character
strings. The name of the file is up to you.
2) The source file that is currently active under the editor
will be modified such that:
printf("Please
insert the disquette in drive a:");
will be changed to:
printf(Strtab[87]);
// "Please insert the disquette in drive a:"
The contents of the string will be replaced by a table
index, and the contents will be left as a commentary in the same line.
In a separate file, we would have a table with:
unsigned char *StrTab[] = {
...
"Please
insert the disquette in drive a:" /* 87 */
...
};
The name of the output file can be changed, the name of the
table can be changed,and you can generate a function call instead of a naked
table index if you wish.
This would allow you
to choose from several tables that contain different languages at run time for
instance.
You can generate the table in the format needed by the
resource compiler, to load them with the primitives for loading strings of
windows.
This is the meaning
of the rather cryptic two buttons at the left of the dialog box:
"Table" or "rc".
This operation works with the currently active file loaded
into the editor. When you specify a file that exists already, and this file is
a string file, recognized by the signature at the beginning, the strings are
appended at the end of the file, and the index of the table modified
accordingly.
In this way you can add all the strings of all the source
files of your program into a single file.
Important:
Do not forget that Wedit doesn't add the declaration for the
table. It is up to you to add it either at the beginning of your source file or
in a global include seen by all the modified files. This would be very
difficult to do automatically. It is up to you too, to choose a name for the
table that doesn't provoke a conflict with other names in the program's name
space.
It is a good idea, when generating for the first time the table, to make a copy of your program, since this operation, once done, and files saved, is very difficult to undo... In the case of name conflicts, the operation should be restarted at the beginning.